// 虚函数与形状

#include <iostream>
using namespace std;

class Shape {
public:
    virtual void WhatAmI() {
        cout << "这是基本形状\n";
    }
};

class Pyramid : public Shape {
public:
    void WhatAmI() override {
        cout << "这是金字塔形状\n";
    }
};

class Sphere : public Shape {
public:
    void WhatAmI() override {
        cout << "这是球形\n";
    }
};

int main() {
    cout << "虚形状程序\n";

    Shape   myShape;
    Sphere  mySphere;
    Pyramid myPyramid;

    Shape* base;

    base = &myShape;
    base->WhatAmI();

    base = &mySphere;
    base->WhatAmI();

    base = &myPyramid;
    base->WhatAmI();

    cout << "哇，太难了\n";
}